﻿using B.S.Warehouse.ErrorCord;
using B.S.Warehouse.Write.Api.Application.Command.StockInDetailCommand;
using MediatR;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Warehouse.Write.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class StockInDetailSController : ControllerBase
    {
        private readonly IMediator mediator;
        public StockInDetailSController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 入库管理明细添加
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult<object>> AddStockInDetail(AddStockInDetailCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 入库管理明细删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task<ApiResult<int>> DelStockInDetail([FromQuery] DelStockInDetailCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        ///  入库管理明细修改
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<ApiResult<int>> UpdateStockInDetail(UpdateStockInDetailCommand request)
        {
            return await mediator.Send(request);
        }

    }
}
